package com.sc.VenusQueryBeta.model.login;

import com.hengjun.kingstar.sdk.base.BaseModel;
import com.hengjun.kingstar.sdk.helper.RetrofitCreateHelper;
import com.hengjun.kingstar.sdk.helper.RxHelper;
import com.sc.VenusQueryBeta.api.Host;
import com.sc.VenusQueryBeta.api.login.LoginApi;
import com.sc.VenusQueryBeta.contract.login.FirstLoginContract;
import com.sc.VenusQueryBeta.model.bean.login.EquipmentLoginBean;
import com.sc.VenusQueryBeta.model.bean.login.FirstLoginSubmintBean;

import io.reactivex.Observable;

/**
 * Created by SC-02 on 2018/9/19.
 * 登錄model 继承Basemodel 并且实现契约累的model方法
 */


public class FirstLoginModel extends BaseModel implements FirstLoginContract.ILoginModel {
    public static FirstLoginModel newInstance() {
        return new FirstLoginModel();
    }

    @Override
    public Observable<EquipmentLoginBean> getFirstBUserLoginCode(String clientUID, String deviceUID, String deviceType, String registerSmsnum) {
        //第一次登陆设备，获取验证码
        return RetrofitCreateHelper.createApi(LoginApi.class, Host.HostVGSestMessageserver).EpLogin(clientUID, deviceUID, deviceType, registerSmsnum).compose(RxHelper.<EquipmentLoginBean>rxSchedulerHelper());
    }

    @Override
    public Observable<FirstLoginSubmintBean> firstSumbit(String id, String smsCode, String password, String clientUID, String deviceUID, String deviceType) {
        //第一次登录的页面确定后继续掉通过伺服器确认注册
        return RetrofitCreateHelper.createApi(LoginApi.class, Host.HostVGSestMessageserver).firstsubmint(id, smsCode, password, clientUID, deviceUID, deviceType).compose(RxHelper.<FirstLoginSubmintBean>rxSchedulerHelper());
    }
}
